<?php
/**
 * Name: UserController.class.php
 * Description: 用户控制器
 * User: DIY
 * Date: 2016/9/25
 * Time: 17:29
 */

namespace Admin\Controller;


use Admin\Library\BootstrapPage;
use Common\Model\UserModel;

class UserController extends BaseController
{

    /*
     * 用户列表
     * */
    public function index(){
        $data = array(
            '1'=>'1',
        );
        if(I('get.user_name')){
            $data['user_name'] = array('like','%'.I('get.user_name').'%');
        }
        if(I('get.user_phone')){
            $data['user_phone'] = I('get.user_phone');
        }
        if(I('get.user_role')){
            $data['user_role'] = I('get.user_role');
        }
        $UserModel = new UserModel();
        $count = $UserModel->where($data)->count();
        $Page = new BootstrapPage($count,20);
        $list['page'] = $Page->show();
        $list['list'] = $UserModel
            ->where($data)
            ->limit($Page->firstRow.','.$Page->listRows)
            ->select();
        $this->assign('list',$list);
        $this->display();

    }

    public function add(){

    }

    /*
     * 查看用户信息
     * */
    public function show(){

    }

}